<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns="http://www.w3.org/1999/xhtml"  
                xmlns:h="http://java.sun.com/jsf/html"  
                xmlns:f="http://java.sun.com/jsf/core"  
                xmlns:p="http://primefaces.org/ui" 
                template="./TemplateApp.xhtml">

  
    <ui:define name="left">
        
    </ui:define>

    <ui:define name="content">
        content
    </ui:define>

    <ui:define name="bottom">
        <h:outputLink id="loginLink" value="javascript:void(0)" onclick="dlg.show()" title="login">     
    <p:graphicImage value="/images/login.gif" />  
</h:outputLink>  
  
<p:growl id="growl" showDetail="true" life="3000" />  
  
<p:dialog id="dialog" header="Login" widgetVar="dlg">  
    <h:form>  
  
        <p:panelGrid columns="2" cellpadding="5">  
            <h:outputLabel for="username" value="Username:" />  
                <p:inputText value="#{mBLogin.user}"   
                    id="username" required="true" label="username" />  
              
            <h:outputLabel for="password" value="Password:" />  
            <h:inputSecret value="#{mBLogin.pass}"   
                    id="password" required="true" label="password" />  
              
            <f:facet name="footer">  
                <p:commandButton id="loginButton" value="Login" update=":growl"   
                                 action="#{mBLogin.action}"   
                    oncomplete="handleLoginRequest(xhr, status, args)"/>  
            </f:facet>  
        </p:panelGrid>  
          
    </h:form>  
</p:dialog>  
  
<script type="text/javascript">  
    function handleLoginRequest(xhr, status, args) {  
        if(args.validationFailed || !args.loggedIn) {  
            jQuery('#dialog').effect("shake", { times:10 }, 100);  
        } else {  
            dlg.hide();  
            jQuery('#loginLink').fadeOut();  
        }  
    }  
</script>  
    </ui:define>

</ui:composition>
